﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Common
{
    public static class DateTimeHelper
    {
        // Methods
        public static DateTime ConvertTimestamp(double timestamp)
        {
            DateTime time = new DateTime(0x7b2, 1, 1, 0, 0, 0, 0);
            return time.AddSeconds(timestamp).ToLocalTime();
        }

        public static double ConvertToTimestamp(DateTime value)
        {
            DateTime time = new DateTime(0x7b2, 1, 1, 0, 0, 0, 0);
            TimeSpan span = (TimeSpan)(value - time.ToLocalTime());
            return span.TotalSeconds;
        }
    }

}
